import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.13
import QtQuick.Dialogs 1.0
import QtGraphicalEffects 1.12
ApplicationWindow {
    id:myProFilePage
    x:Screen.desktopAvailableWidth/2-width/2
    y: Screen.desktopAvailableHeight/2-height/2
    width: 320
    height: 480
    title: qsTr("my profile")
    flags: Qt.Window | Qt.FramelessWindowHint //去标题栏
    color: "#00000000"
    function getMyProfileBySession(sessionid){
        console.log("mySession " , sessionid)
    }
    Rectangle {
        x:3
        y:16
        width: parent.width-6
        height: parent.height-6
        Rectangle{
            width: parent.width
            height: parent.height
            id:rect
            anchors.centerIn: parent
            color:"#eeeeee"
        }

        DropShadow {
            anchors.fill: rect
            horizontalOffset: 3
            verticalOffset: 3
            radius: 8.0
            samples: 16
            color: "#80000000"
            source: rect
        }
    }

    Rectangle{
        y:16
        x:3
        width: parent.width-6
        height: parent.height/5*2
        Image {
            width: parent.width
            height: parent.height
            source: "qrc:/other/icon/bg.jpeg"
        }
    }

    Rectangle{
        id: removeWindows
        x:32
        height: 48
        width: parent.width-x*2
        color: "#00ffffff"

        MouseArea { //为窗口添加鼠标事件
            acceptedButtons: Qt.LeftButton //只处理鼠标左键
            property point clickPos: "0,0"
            anchors.fill: removeWindows
            onPressed: { //接收鼠标按下事件
                clickPos  = Qt.point(mouse.x,mouse.y)
            }
            onPositionChanged: { //鼠标按下后改变位置
                //鼠标偏移量
                var delta = Qt.point(mouse.x-clickPos.x, mouse.y-clickPos.y)
                //如果mainwindow继承自QWidget,用setPos
                myProFilePage.setX(myProFilePage.x+delta.x)
                myProFilePage.setY(myProFilePage.y+delta.y)
            }
        }

    }
    Rectangle {
        y:16
        id:buttonExit
        width: 32
        height: 32
        color: "#00666666"
        visible: true
        Image {
            width: 32
            height: 32
            source: "qrc:/other/icon/close.png"
        }
        MouseArea{
            anchors.fill: buttonExit
            onClicked: hide()
        }

    }

    Rectangle{
        id:myProFileIcon
        x:parent.width/2-width/2
        width: 130
        height: 130
        radius: width/2
        //        color: "#00333333"
        //        antialiasing: false
        //        rotation: 0
        Image {
            id: _source
            smooth: true
            visible: false
            anchors.fill: parent
            source: "qrc:/other/icon/qqimg.jpg"
//            sourceSize: Qt.size(parent.size, parent.size)
            width: 128
            height: 128
            antialiasing: true

        }
        Rectangle {
            id: _mask
            color: "black"
            anchors.fill: parent
            radius: width/2
            visible: true
            antialiasing: true
            smooth: true

        }
        OpacityMask {
            id:mask_image
            anchors.fill: _source
            source: _source
            maskSource: _mask
            visible: true
            antialiasing: true
        }


    }


    Text {
        id: myProfile_name
        y:myProFileIcon.height+5
        width:parent.width
        height: 32

        text: qsTr("C++ Wu")
        verticalAlignment: Text.AlignVCenter
        horizontalAlignment: Text.AlignHCenter
        elide: Text.ElideMiddle
        fontSizeMode: Text.Fit
        font.pixelSize: 18

        Text {
            id: userProfile_Sign

            width: text.length*font.pixelSize
            x:parent.width/2-width/2
            y: myProfile_name.height+5
            height: font.pixelSize+5
            text: qsTr("个性签名")
            verticalAlignment: Text.AlignVCenter
            horizontalAlignment: Text.AlignHCenter
            font.pixelSize: 12
        }

        Image {
            id: editSign
            x: userProfile_Sign.x+userProfile_Sign.width+5
            y: myProfile_name.height+5
            width: 16
            height: 16
            source: "qrc:/other/icon/edit.png"
        }
    }

    Text {
        id: userProfile_age
        width: 60
        height: 60
        x:60
        y:myProFileIcon.height+myProfile_name.height+30
        text: qsTr("30")
        horizontalAlignment: Text.AlignHCenter
        verticalAlignment: Text.AlignVCenter
        elide: Text.ElideNone
        font.pixelSize: 30
    }
    Text {
        id: userProfile_age_lab
        y:userProfile_age.y+userProfile_age.height/2
        x:userProfile_age.x
        width: 60
        height: 60
        text: qsTr("年龄")
        horizontalAlignment: Text.AlignHCenter
        verticalAlignment: Text.AlignVCenter
        font.pixelSize: 14
    }

    Text {
        id: userProfile_birthday_lab
        x: parent.width/2-width/2
        y: userProfile_age_lab.y
        width: 60
        height: 60
        text: qsTr("生日")
        verticalAlignment: Text.AlignVCenter
        font.pixelSize: 14
        horizontalAlignment: Text.AlignHCenter
    }

    Text {
        id: userProfile_birthday_Year
        x: parent.width/2-width/4*3
        y: userProfile_age.y
        width: 60
        height: 60
        text: qsTr("2")
        verticalAlignment: Text.AlignVCenter
        horizontalAlignment: Text.AlignHCenter
        font.pixelSize: 30
    }

    Text {
        id: userProfile_birthday_Day
        x: parent.width/2-width/4
        y: userProfile_age.y-5
        width: 60
        height: 60
        text: qsTr("20")
        verticalAlignment: Text.AlignVCenter
        font.pixelSize: 16
        horizontalAlignment: Text.AlignHCenter
    }

    Text {
        id: myProFilePage_id_lab
        x:parent.width/8
        y:parent.height*3/4
        width: 64
        text: qsTr("ID:")
        verticalAlignment: Text.AlignVCenter
        horizontalAlignment: Text.AlignRight
        font.pixelSize: 14
    }

    Text {
        id: myProFilePage_id
        x: myProFilePage_id_lab.x+myProFilePage_id_lab.width+5
        y:myProFilePage_id_lab.y
        width: 164
        height: 20
        text: qsTr("1223456")
        verticalAlignment: Text.AlignVCenter
        horizontalAlignment: Text.AlignLeft
        font.pixelSize: 14
    }

    Text {
        id: myProFilePage_nick_lab
        x: myProFilePage_id_lab.x
        y: myProFilePage_id_lab.y+myProFilePage_id_lab.height+5
        width: 64
        text: qsTr("昵称:")
        verticalAlignment: Text.AlignVCenter
        horizontalAlignment: Text.AlignRight
        font.pixelSize: 12
    }

    Text {
        id: myProFilePage_nick
        x: myProFilePage_nick_lab.x+myProFilePage_nick_lab.width+5
        y: myProFilePage_nick_lab.y
        text: qsTr("Wu")
        font.pixelSize: 12
    }

    Text {
        id: myProFilePage_userAge_lab
        x: myProFilePage_nick_lab.x
        y: myProFilePage_nick_lab.y+myProFilePage_nick_lab.height
        width: 64
        text: qsTr("用户年龄:")
        verticalAlignment: Text.AlignVCenter
        horizontalAlignment: Text.AlignRight
        font.pixelSize: 12
    }

    Text {
        id: element12
        x: myProFilePage_userAge_lab.x+myProFilePage_userAge_lab.width+5
        y: myProFilePage_userAge_lab.y
        text: qsTr("Text")
        font.pixelSize: 12
    }





}















/*##^## Designer {
    D{i:0;height:480;width:360}
}
 ##^##*/
